Brushless 28 Click
Brushless 28 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Stefan Filipovic
- Date : Feb 2026.
- Type : SPI type
Software Support
Example Description
This example demonstrates the use of the Brushless 28 Click board by driving the motor in both directions at different speeds.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.Brushless28
Example Key Functions
- brushless28_cfg_setup This function initializes Click configuration structure to initial values.
void brushless28_cfg_setup(brushless28_cfg_t *cfg)
Brushless 28 configuration object setup function.
Brushless 28 Click configuration object.
Definition brushless28.h:266
- brushless28_init This function initializes all necessary pins and peripherals used for this Click board.
err_t brushless28_init(brushless28_t *ctx, brushless28_cfg_t *cfg)
Brushless 28 initialization function.
Brushless 28 Click context object.
Definition brushless28.h:242
- brushless28_default_cfg This function executes a default configuration of Brushless 28 Click board.
err_t brushless28_default_cfg(brushless28_t *ctx)
Brushless 28 default configuration function.
- brushless28_set_duty_cycle This function sets the PWM duty cycle in percentages ( Range[ 0..1 ] ).
err_t brushless28_set_duty_cycle(brushless28_t *ctx, float duty_cycle)
Brushless 28 sets PWM duty cycle.
- brushless28_switch_direction This function switches the direction of motor rotation by toggling the DIR pin logic state.
void brushless28_switch_direction(brushless28_t *ctx)
Brushless 28 switch direction function.
- brushless28_release_brake This function releases brake by setting the BRAKE pin to high logic state.
void brushless28_release_brake(brushless28_t *ctx)
Brushless 28 release brake function.
Application Init
Initializes the driver and performs the Click default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
@ BRUSHLESS28_OK
Definition brushless28.h:293
#define BRUSHLESS28_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition brushless28.h:224
void application_init(void)
Definition main.c:34
#define MIKROBUS_POSITION_BRUSHLESS28
Definition main.c:28
Application Task
Controls the motor speed by changing the PWM duty cycle every 500 milliseconds. The duty cycle ranges from 0% to 100%. At the minimal speed, the motor switches direction. Each step will be logged on the USB UART where you can track the program flow.
{
static int8_t duty_cnt = 0;
static int8_t duty_inc = 1;
float duty = duty_cnt / 10.0;
log_printf( &logger, "> Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
Delay_ms ( 500 );
duty_cnt += duty_inc;
if ( duty_cnt > 10 )
{
duty_cnt = 9;
duty_inc = -1;
}
else if ( duty_cnt < 0 )
{
duty_cnt = 1;
duty_inc = 1;
log_printf( &logger, " Pull brake\r\n" );
Delay_ms ( 1000 );
log_printf( &logger, " Switch direction\r\n" );
Delay_ms ( 1000 );
log_printf( &logger, " Release brake\r\n" );
Delay_ms ( 1000 );
}
}
void brushless28_pull_brake(brushless28_t *ctx)
Brushless 28 pull brake function.
void application_task(void)
Definition main.c:70
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.